package com.xb.loan.usercenter.account.impl;

import com.xb.loan.account.service.ICashStatService;
import com.xb.loan.account.service.bean.CashStatVO;
import com.xb.loan.log.exception.BizException;
import com.xb.loan.usercenter.account.common.VerifySet;
import com.xb.loan.usercenter.account.dao.CashStatDao;
import com.xb.loan.usercenter.account.dao.bean.CashStat;
import com.xb.loan.util.common.ObjectOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service("cashStatService")
public class CashStatServiceImpl implements ICashStatService {

	@Autowired
	private CashStatDao cashStatDao;
	
	@Override
	public void createCashStat(CashStatVO cashStatVO) throws BizException {
		VerifySet.verifyCashStatVO(cashStatVO);
		
		CashStat cashStat = ObjectOperation.convertByClasses(cashStatVO, CashStat.class);
		
		cashStatDao.insertCashStat(cashStat);
	}

	@Override
	public void updateCashStat(String accountId, String partnerId) throws BizException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("accountId", accountId);
		params.put("partnerId", partnerId);
		cashStatDao.updateCashStat(params);
	}

}
